package com.gpnu.crm.web.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;

import com.gpnu.crm.domain.SystemDictionary;
import com.gpnu.crm.query.QueryObject;
import com.gpnu.crm.service.ISystemDictionaryService;


@Controller
@RequestMapping("/systemDictionary")
public class SystemDictionaryController {
	  @Autowired
	  private ISystemDictionaryService systemDictionaryService;

	  
	  @RequestMapping("list")
	  public String list(@ModelAttribute("qo") QueryObject qo, Model model)
	  {
	    model.addAttribute("pageInfo", systemDictionaryService.query(qo));
	    return "systemDictionary/list";
	  }
	  
	  @RequestMapping({"saveOrUpdate"})
	  public String saveOrUpdate(SystemDictionary entity) {
	    systemDictionaryService.saveOrUpdate(entity);
	    return "redirect:/systemDictionary/list.do";
	  }
	  
	  @RequestMapping({"delete"})
	  
	  public String delete(Long id) {
	    if (id != null) {
	      systemDictionaryService.delete(id);
	    }
	    return "redirect:/systemDictionary/list.do";
	  }
}
